package com.gs.api.project.video.web;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.gs.api.core.Result;
import com.gs.api.project.video.entity.BzBanner;
import com.gs.api.project.video.entity.BzNotice;
import com.gs.api.project.video.service.IBzBannerService;
import com.gs.api.project.video.service.IBzNoticeService;
import com.gs.api.weixin.service.WxAdvertService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author guoyunfei on 2022/3/12 22:43
 * @className VideoParseController
 * @description TODO
 * @Version 1.0
 */

@RestController
@RequestMapping("{appid}/index")
public class IndexController {

    @Autowired
    private IBzBannerService iBzBannerService;

    @Autowired
    private IBzNoticeService iBzNoticeService;

    @Autowired
    private WxAdvertService wxAdvertService;

    @RequestMapping(value = "data")
    public Result videoParse(){

        Map<String,Object> result = new HashMap<>();

        List<BzBanner> list = iBzBannerService.list();

        BzNotice notice = iBzNoticeService.getOne(new QueryWrapper<BzNotice>().orderByDesc("create_Time").last("limit 1"));

        result.put("bannerList",list);
        result.put("notice",notice);
        return Result.success(result);
    }

}
